package org.cmg.study.spring.controller;

import org.cmg.study.spring.entity.User;
import org.cmg.study.spring.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.jws.WebParam;

/**
 * @author CMG
 * @version 1.0
 * @cLassName UserController
 * @description
 * @date 2021/9/3 16:33
 **/
@Controller
@RequestMapping("/user")
public class UserController {
    @Autowired
    private IUserService service;

    @RequestMapping("/login")
    public String getLogin(Model model){
        User user = new User();
        user.setName("xg");
        user.setPwd("12345");
        service.login(user);
        model.addAttribute("user", user);
        return "login";
    }

    @RequestMapping("/register")
    public String getRegister(Model model){
        User user = new User();
        user.setName("xg");
        user.setPwd("12345");
        service.login(user);
        model.addAttribute("user", user);
        return "register";
    }
}
